package com.meida.boot.handler.app;

import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.PageInterceptor;
import com.meida.common.mybatis.model.ListModel;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.product.client.entity.ProdShop;
import com.meida.module.product.provider.service.ProdProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 购物车列表扩展(添加推荐商品)
 *
 * @author zyf
 */
@Component("shopCardListHandler")
public class ShopCardListHandler implements PageInterceptor<ProdShop> {
    @Autowired
    private ProdProductService productService;


    @Override
    public void complete(CriteriaQuery<ProdShop> cq, List<EntityMap> result, EntityMap extra) {
        List<EntityMap> recommendList = productService.listRecommend(10, false);
        extra.put("recommendList", recommendList);

    }
}
